<template>
	<view>
		<view class="carList">
			<radio-group @change="radioChange">
				<view class="carItem" v-for="(item, index) in items" :key="item.value">
					<label class="uni-list-cell uni-list-cell-pd carLabel">
						<img src="/static/myCar.jpg" alt="" />
						<view class="carInfo">
							<view>车型：奔驰-GR</view>
							<view>车牌：豫M34523 </view>
						</view>
						<view class="choose">
							<radio :value="item.value" :checked="index === current" />
						</view>

					</label>
				</view>
			</radio-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				items: [{
						type: '奔驰-GR',
						number: '豫M34523',
					},
					{
						type: '奔驰-GR',
						number: '豫M34523',
					},
					{
						type: '奔驰-GR',
						number: '豫M34523',
					},

				],
				current: 0
			}
		},
		methods: {
			radioChange: function(evt) {
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].value === evt.detail.value) {
						this.current = i;
						break;
					}
				}
			}
		}
	}
</script>

<style>
	.carList {
		padding-top: 6px;
		padding-left: 6px;
		padding-right: 6px;
	}

	.carItem {
		width: 100%;
		height: 113px;
		/* background-color: antiquewhite; */
		margin-bottom: 5px;
		box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3), -2px -2px 5px rgba(0, 0, 0, 0.2);
	}

	.carItem img {
		width: 77px;
		height: 77px;
		margin-left: 17px;
		margin-top: 18px;
		border-radius: 38px;
	}

	.carLabel {
		display: flex;
		justify-content: space-between;
	}

	.carInfo {
		line-height: 30px;
		margin-top: 18px;
	}

	.choose {
		line-height: 113px;
		margin-right: 29px;
	}
</style>